package dmp.dianxin;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DianxinList {

	 private static final String FILE_NAME = "dianxin";

	private static List<String> url_parse_param = new ArrayList<String>();

	static {
		File file = new File(System.getProperty("user.dir") + "/" + FILE_NAME);

		if (file.exists()) {
			BufferedReader br = null;
			try {
				br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
				String line = null;
				while ((line = br.readLine()) != null) {
					url_parse_param.add(line);
				}

			} catch (Exception e) {
				e.printStackTrace();
			} finally {
				if (br != null) {
					try {
						br.close();
					} catch (IOException e) {
						e.printStackTrace();
					}
				}
			}
		}
	}

	public static List<String> elements() {
		return url_parse_param;
	}

	public static Map<String, String> getParserMap() {
		Map<String, String> map = new HashMap<>();

		List<String> es = DianxinList.elements();
		for (String each : es) {
			String name = each.split("\\|")[0];
			map.put(name, each);
		}
		return map;
	}

}
